package com.secf.service.port.hpy.hys.test;

/**
 * @Author ms
 * @Date 2024-08-08
 */
public class StudentScores {
    public static void main(String[] args) {
        // 存储学生成绩的数组
        int[] scores = {85, 92, 78, 90, 88};

        // 初始化最高分和最低分
        int highest = scores[0];
        int lowest = scores[0];

        // 遍历数组找出最高分和最低分
        for (int i = 1; i < scores.length; i++) {
            if (scores[i] > highest) {
                highest = scores[i];
            }
            if (scores[i] < lowest) {
                lowest = scores[i];
            }
        }

        System.out.println("最高分: " + highest);
        System.out.println("最低分: " + lowest);
    }
}
